//
//   WHRTGDetail.m
//  仿造淘宝商品详情页
//
//  Created by yixiang on 16/3/25.
//  Copyright © 2016年 yixiang. All rights reserved.
//商品详情

#import "WHRMSDetail.h"
#import "YX.h"
#import "WHRProductIntroduceCell.h"
#import "UITableView+SDAutoTableViewCellHeight.h"
#import "AXspellFirstModel.h"


@interface  WHRMSDetail()

@property (nonatomic , strong) NSMutableArray<goodsDetailModel *> *modelsArray;
@property (nonatomic, strong) NSMutableArray *arrayImages;
@end

@implementation  WHRMSDetail



- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    return 1;
    
}


- (void)setGoodsId:(NSString *)goodsId {
    
    _goodsId = goodsId;
    [self requestTgList];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return _arrayImages.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 320;
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    WHRProductIntroduceCell *cell = [tableView dequeueReusableCellWithIdentifier:[WHRProductIntroduceCell reuseID]];
    if (!cell) {
        cell = [[WHRProductIntroduceCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[WHRProductIntroduceCell reuseID]];
    }
    cell.imageUrlStr = _arrayImages[indexPath.row];
    
    return cell;
}

#pragma mark - requestNetwork


- (void)requestTgList {
    
    
    ZX_WEAK_SELF
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    params[@"goodsId"]= _goodsId;
    
    [NetWorkHelp yl_postDataWith:params url:URL_SPLIT(URL_Store, URL_Store_selectGoodsInfo) success:^(id respose) {
        
        NSLog(@"123");
        weakSelf.arrayImages = respose[@"body"][@"goodsInfoVOs"][@"goodsDetails"];
        [self.tableView reloadData];
        
        
        
    } failure:^(NSError *error) {
        
    }];
    
    
}

@end
